const api = require('../utils/request.js')
module.exports = {
  updateUserInfo: function (data) {
    return api.request({
      url: `/wechat/updateUserInfo`,
      method: 'post',
      data
    })
  },
  // 获取营地列表
  campList(params = {}) {
    return api.request({
      url: '/wechat/camp/list',
      method: 'GET',
      data: params
    })
  },
  // 获取营地详情
  campDetail(campId) {
    return api.request({
      url: `/wechat/camp/${campId}`,
      method: 'GET'
    })
  },
  //获取营地服务设施选择数据
  getFacilitiesA(id) {
    return api.request({
      url: `/wechat/facility/getInfo/` + id,
      method: 'GET'
    })
  },
  //营地营位根据id获取 /wechat/campsite/list
  getCampCampsite(id) {
    // console.log(id)
    return api.request({
      url: `/wechat/campsite/list?campId=` + id,
      method: 'GET'
    })
  },
  //营地周边景点 /wechat/spots/getInfoByCampId/{campId}
  getSpots(campId) {
    return api.request({
      url: `/wechat/spots/getInfoByCampId/${campId}`,
      method: 'GET'
    })
  },
  // 其他项目 /wechat/project/getInfoByCampId/{campId}
  getProject(campId) {
    return api.request({
      url: `/wechat/project/getInfoByCampId/${campId}`,
      method: 'GET'
    })
  },
  // 活动列表 /wechat/activity/getInfoByCampId/{campId}
  getActivity(campId) {
    return api.request({
      url: `/wechat/activity/getInfoByCampId/${campId}`,
      method: 'GET'
    })
  },
  getBannerList: function () {
    return api.request({
      url: '/wechat/banner/list',
      method: 'GET'
    })
  },
  //营地服务设施
  serviceFacilities() {
    return api.request({
      url: "/wechat/facility/list",
    })
  },
  //获取营地信息
  campDetail(campId) {
    return api.request({
      url: `/wechat/camp/${campId}`,
      method: 'GET'
    })
  },
  // 评论列表
  evaluateList: function (campId) {
    return api.request({
      url: '/wechat/evaluate/list',
      method: 'GET',
      data: {
        campId: campId
      }
    })
  },
  // 收藏营地 与取消收藏
  collectCamp(data) {
    return api.request({
      url: '/wechat/collect',
      method: 'POST',
      data
    })
  },
  // 取消收藏营地
  removeCollectCamp(data) {
    return api.request({
      url: '/wechat/collect',
      method: 'POST',
      data
    })
  },
  // 首场列表
  collectList(userId) {
    return api.request({
      url: "/wechat/collect/list",
      method: "GET",
      data: {
        userId
      }
    })
  },
  addAppointment(data) {
    console.log(data, 'data');
    return api.request({
      url: '/wechat/appointment',
      method: 'post',
      data
    })
  },
  addEvaluate(data) {
    console.log(data, 'data');
    return api.request({
      url: '/wechat/evaluate',
      method: 'post',
      data
    })
  },
  // 景点添加
  addScenic(data) {
    return api.request({
      url: `/wechat/spots/add`,
      method: 'post',
      data
    })
  },
  // 景点删除
  campDelScenic(scenicId) {
    return api.request({
      url: '/wechat/spots/' + scenicId,
      method: 'delete'
    })
  },
  //添加活动
  addActivity(data) {
    return api.request({
      url: `/wechat/activity/add`,
      method: 'post',
      data
    })
  },
  // 删除活动
  campDelActivity(activityId) {
    return api.request({
      url: '/wechat/activity/' + activityId,
      method: 'delete'
    })
  },
  // 项目添加
  addOtherProject(data) {
    return api.request({
      url: `/wechat/project/add`,
      method: 'post',
      data
    })
  },
  // 项目删除
  campDelProject(projectId) {
    return api.request({
      url: '/wechat/project/' + projectId,
      method: 'delete'
    })
  },
  //营地营位添加
  // campAddCampsite(data) {
  //   return api.request({
  //     url: '/wechat/campsite',
  //     method: 'post',
  //     data
  //   })
  // },
  // //营地营位删除
  // campDelCampsite(campsiteId) {
  //   return api.request({
  //     url: '/wechat/campsite/' + campsiteId,
  //     method: 'delete'
  //   })
  // },
  getCampsiteList: function (query) {
    return api.request(
      "/wechat/campsite/list",
      "get",
      query
    )
  },
  //营地营位删除
  campDelCampsite(campsiteId) {
    return api.request({
      url: '/wechat/campsite/' + campsiteId,
      method: 'delete'
    })
  },
  getCampsiteList: function (query) {
    return api.request(
      "/wechat/campsite/list",
      "get",
      query
    )
  },
  //新增营地
  addCamp(data) {
    return api.request({
      url: '/wechat/camp',
      method: "POST",
      data
    })
  },
  // 上传服务设施
  addService(data) {
    return api.request({
      url: "/wechat/facility/add",
      method: "POST",
      data
    })
  },
  //上传服务
  addFacility(data) {
    return api.request({
      url: '/wechat/facilityType/add',
      method: 'POST',
      data
    })
  },
  //查询设施
  facilityTypeList() {
    return api.request({
      url: '/wechat/facilityType/list',
      method: 'GET'
    })
  },
  //获取服务设施信息
  getFacilityType() {
    return api.request({
      url: '/wechat/facilityType/list',
      method: 'GET'
    })
  },
  campUpInfo(params) {
    return api.request({
      url: '/wechat/camp',
      method: 'put',
      data: {
        "campId": params.campId,
        "address": params.address,
        "campName": params.campName,
        "campType": params.campType,
        "imageUrl": params.imageUrl,
        "introduce": params.introduce,
        "latitude": params.latitude,
        "location": params.location,
        "longitude": params.longitude,
        "linkman": params.linkman,
        "phone": params.phone,
        "specificTime": params.timeType,
        "userId": params.userId,
        "userType": params.userType
      }
    })
  },
}